#include "downloadtask.h"
#include <QFileInfo>

DownloadTask::DownloadTask(const QUrl &url, const QString &rename, const QString &savePath,
             int priority, QObject *parent):
    m_url(url), m_priority(priority), QObject(parent)
{
    if(rename == ""){
        QString ss = url.path();
        if(url.isValid() || !url.path().isEmpty()){
            QFileInfo fileInfo(url.path());
            m_rename = fileInfo.fileName();
        }else{
            QString s = url.toString();
            m_rename = url.toString();
        }
    }else{
        m_rename = rename;
    }

    if(savePath == ""){
        m_savePath = "D:\\";
    }else{
        m_savePath = savePath;
    }
}

QUrl DownloadTask::url(){
    return m_url;
}

QString DownloadTask::rename(){
    return m_rename;
}

QString DownloadTask::path(){
    return m_savePath;
}

int DownloadTask::priority(){
    return m_priority;
}




